class Queue:
    def __init__(self,size=100):
        self.queue=[0 for _ in range(size)]
        self.rear=0 #队尾指针
        self.front=0 #队首指针
        self.size=size

    def push(self,element):
        if not self.is_filled():
            self.rear=(self.rear+1)%self.size
            self.queue[self.rear]=element
        else:
            raise IndexError('Queue is filled')

    def pop(self):
        if not self.is_empty():
            self.front=(self.front+1)%self.size
            return self.queue[self.front]
        else:
            raise IndexError('Queue is empty')

    #判定是否队空
    def is_empty(self):
        return self.rear==self.front

    def is_filled(self):
        return (self.rear+1)%self.size==self.front

q=Queue(5)
for i in range(4):
    q.push(i)
print(q.is_filled())
print(q.pop())
q.push(4)